#7
score = []
name1 = []
name2 = []
Yearsize = 249
for index in range(249):
    itemToBeInserted1 = score[index]
    itemToBeInserted2 = name1[index]
    itemToBeInserted3 = name2[index]
    sortedPointer = index - 1
    while score[sortedPointer] > itemToBeInserted1 and sortedPointer > -1:
        score[sortedPointer + 1] = score[sortedPointer]
        name1[sortedPointer + 1] = name1[sortedPointer]
        name2[sortedPointer + 1] = name2[sortedPointer]
        sortedPointer -= 1
    score[sortedPointer + 1] = itemToBeInserted1
    name1[sortedPointer + 1] = itemToBeInserted2
    name2[sortedPointer + 1] = itemToBeInserted3



#8a
class TreasureChest:
    def __init__(self,question = None,answer = 0,points = 0):
        self.__question = question      #string
        self.__answer = answer          #integer
        self.__points = points          #integer
    # 8cI
    def getQuestion(self):
        return self.__question
    # 8cII
    def checkAnswer(self,ans):
        if ans == self.__answer:
            return True
        else:
            return False
    # 8cIII
    def getPoints(self,tries):
        rawPoints = self.__points
        if tries ==1:
            get = rawPoints
        elif tries == 2:
            get = rawPoints//2
        elif tries == 3 or 4:
            get = rawPoints//4
        else:
            get = 0
        return get


#8b
def readData():

    try: n = open("TreasureChestData.txt","r")
    except:
        print("file is not found")
    else:
        list = n.readlines()
        q = []
        a = []
        p = []
        for i in range(1,len(list)):
            if i%3 == 0:
                q.append(list[i-1])
            if i%3 == 1:
                a.append(list[i-1])
            if i%3 == 2:
                p.append(list[i-1])
        arrayTreasure = []
        for number in range(len(q)):
            arrayTreasure.append(TreasureChest(q[number],a[number],p[number]))
    return arrayTreasure





